package com.dididoctor.doctor.Bean;

import org.litepal.crud.DataSupport;

import java.io.Serializable;
import java.util.List;

public class workTitleLitapal extends DataSupport implements Serializable{


//	"wtId”:”1”
//			"name”:”名称”
	
	private String wtId;
	private String name;

	public String getWtId() {
		return wtId;
	}

	public void setWtId(String wtId) {
		this.wtId = wtId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	/**
	 * 医院列表
	 * @return
	 */
	public static List<workTitleLitapal> getHospitallitapalCity(String wtId){
		List<workTitleLitapal> findAll = DataSupport.where("wtId = ?",wtId).find(workTitleLitapal.class);
		return findAll;
		
	}
	
	/**
	 * 医院列表模糊查询
	 * @return
	 */
	public static List<workTitleLitapal> getAllHospitallitapal(String name,String wtId){
		 List<workTitleLitapal> find = DataSupport.where("name like ? and wtId = ?", "%" + name + "%",wtId).find(workTitleLitapal.class);
		return find;
		
	}

	/**
	 * 通过id遍历数据
	 * @param wtId
	 * @return
	 */
	public static workTitleLitapal getidHospitallitapal(String wtId){
		List<workTitleLitapal> all = null;
		if (!"".equals(wtId) && wtId != null){
			all = DataSupport.where(" wtId = ?" ,wtId).find(workTitleLitapal.class);
		}
		if (all.size()>0 && all !=null){
			return all.get(0);
		}
		    return null;
	}

	/**
	 * @param
	 * @return
	 */
	public static List<workTitleLitapal> getdisarases(){
		List<workTitleLitapal> all = DataSupport.findAll(workTitleLitapal.class);
		if (all.size()>0 && all !=null){
			return all;
		}
		return null;
	}

	/**
	 * 通过医院ID 获取对应内容
	 * @return
	 * @param wname
	 */
	public static String getHospitalIdName(String wname) {
		String name = "";
		if ("".equals(wname )&& wname !=null){
			String[] ids = (wname+",").split(",");
			for (int x = 0; x<ids.length;x++){
				workTitleLitapal hospitalLitapal = workTitleLitapal.getidHospitallitapal(ids[x]);
				if (hospitalLitapal != null){
					name += hospitalLitapal.getName()+",";
				}
			}
		}
		return name;
	}
}
